package com.woniu.commentorder.mapper;

import com.hc.entity.Agree;
import com.hc.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from hc_user where id=#{id}")
    public User getById(int id);
    @Select("select * from hc_agree where user_id=#{id}")
    @Results({
            @Result(column = "paper_id",property = "paper.id"),
            @Result(column = "id",property = "id")
    })
    public List<Agree> getByUser(int id);
    @Insert("insert into hc_agree (paper_id,comment_id,user_id,status) values (#{paper.id},#{comment.id},#{user.id},#{status})")
    public void dianzan(Agree agree);
    @Delete("delete  from hc_agree where user_id=#{user.id} and paper_id=#{paper.id}")
    public void concel(Agree agree);
}
